package service

import (
	"gameserver/server/DBserver/logic"

	"gitee.com/night-tc/gobige/logger"
	"gitee.com/night-tc/gobige/msgdef"
	"gitee.com/night-tc/gobige/msgdef/protomsg"
)

type Service_Proc struct {
	srv *DBService
}

func (this *Service_Proc) MsgProc_DefaultMsgHandler(msg msgdef.IMsg) {
	if msg.Name() == "HeartBeat" {
		return
	}
	logger.Warnf("service MsgProc_Default name:%s msg:%s;", msg.Name(), msg)
}

func (this *Service_Proc) MsgProc_ClientVerifyReq(msg *protomsg.ClientVerifyReq) {

}

// DBUpUserDatasReq 更新数据
func (this *Service_Proc) MsgProc_DBUpUserDatasReq(msg *protomsg.DBUpUserDatasReq) {
	hmsg := new(logic.DBUpUserDatasReq)
	hmsg.DBUpUserDatasReq = msg
	player := this.srv.GetPlayer(msg.PID)
	player.AddMessage(hmsg)
}

// DBGetPlayerInfoReq 获取角色信息
func (this *Service_Proc) MsgProc_DBGetPlayerInfoReq(msg *protomsg.DBGetPlayerInfoReq) {

	hmsg := new(logic.DBGetPlayerInfoReq)
	hmsg.DBGetPlayerInfoReq = msg
	player := this.srv.GetPlayer(msg.PID)
	player.AddMessage(hmsg)
}

// DBGetPlayerTableReq 获取角色信息,单表指定行数
func (this *Service_Proc) MsgProc_DBGetPlayerTableReq(msg *protomsg.DBGetPlayerTableReq) {

	hmsg := new(logic.DBGetPlayerTableReq)
	hmsg.DBGetPlayerTableReq = msg
	player := this.srv.GetPlayer(msg.PID)
	player.AddMessage(hmsg)
}
